package com.example.order.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.example.order.IPayService;
import com.example.order.entity.Result;
import com.example.order.entity.TradePay;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: robert.song
 * @Date: Created in 2021/12/19
 */

@Slf4j
@RestController
@RequestMapping("/pay")
public class PayController {
    @Reference
    private IPayService payService;
    @RequestMapping("/createPayment")
    public Result createPay(@RequestBody TradePay pay){
        return payService.createPayment(pay);
    }
    @RequestMapping("/callbackPayment")
    public Result callbackPayment(@RequestBody TradePay pay) throws Exception{
        return payService.callbackPayment(pay);
    }
}
